Component({
  properties: {
    // 标题
    title: {
      type: String,
      value: ''
    },
    // 是否显示返回按钮
    back: {
      type: Boolean,
      value: false
    },
    // 文字颜色
    color: {
      type: String,
      value: 'black'
    },
    // 背景颜色
    background: {
      type: String,
      value: '#FFF'
    }
  },

  data: {
    statusBarHeight: 0,
    navBarHeight: 44
  },

  lifetimes: {
    attached() {
      // 获取系统信息
      const systemInfo = wx.getSystemInfoSync();
      this.setData({
        statusBarHeight: systemInfo.statusBarHeight
      });
    }
  },

  methods: {
    // 返回上一页
    handleBack() {
      if (this.properties.back) {
        wx.navigateBack({
          delta: 1
        });
      }
    }
  }
}); 